import moment from 'moment';
// 命名规范：Arr普通枚举  field下拉字段枚举  Map表格字段枚举

// 表头筛选字段
const headerForm = {
};
// 表格字段
const tableColumn = {
  // 表格
  labelTableMap: [
    {
      prop: 'id',
      label: 'ID',
      type: 'text',
    },
    {
      prop: 'labelName',
      label: '名称',
      type: 'text',
    },
    {
      prop: 'createTime',
      label: '创建时间',
      type: 'text',
    },
    {
      prop: 'updateTime',
      label: '更新时间',
      type: 'text',
    },
  ],
};
// 表单字段
const editForm = {
  // 筛选表单
  labelFilterMap: [
    {
      prop: 'id',
      type: 'input',
      label: 'ID',
      clearable: true,
      width: 100,
      col: 0,
    },
    {
      prop: 'labelName',
      type: 'input',
      label: '名称',
      clearable: true,
      width: 100,
      col: 0,
    },
    {
      prop: 'createTime',
      startProp: 'createTimeStartTime',
      endProp: 'createTimeEndTime',
      label: '创建时间',
      type: 'datePicker',
      dateType: 'datetimerange',
      format: 'yyyy-MM-dd HH:mm:ss',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      width: 100,
      col: 8,
    },
    {
      prop: 'updateTime',
      startProp: 'updateTimeStartTime',
      endProp: 'updateTimeEndTime',
      label: '更新时间',
      type: 'datePicker',
      dateType: 'datetimerange',
      format: 'yyyy-MM-dd HH:mm:ss',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      width: 100,
      col: 8,
    },
  ],
  // 新增/修改基本信息表单
  labelFormMap: [
    {
      prop: 'allLabelRelationId',
      labelProp: 'allTitleName',
      type: 'select',
      label: '二级标签',
      clearable: true,
      filterable: true,
      optionDynamic: {
        apiKey: 'AllTwoLabelOption',
        params: {},
        methods: 'get',
      },
      optionValue: 'allLabelRelationId',
      optionLabel: 'allTitleName',
      labelCustomClass: 'requiredFormItem',
      col: 24,
    },
    {
      prop: 'status',
      type: 'radio',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      labelCustomClass: 'requiredFormItem',
      customClass: 'genderItem',
      col: 24,
    },
  ]
};
// 其他映射
const otherMap = {
};
// 表单字段校验
const editRule = {
  labelFormRule: {
    allLabelRelationId: [{ required: true, message: '二级标签不能为空', trigger: 'change' }],
    status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  }
};
export default {
  headerForm,
  tableColumn,
  editForm,
  otherMap,
  editRule
};
